function _new(func, ...args) {
  const obj = Object.create(func.prototype);
  const res = func.call(obj, ...args);
  return typeof res === 'object' ? res : obj;
}

function Person(age, name) {
  this.age = age;
  this.name = name;
}

const a = myNew(Person, 3, 'yang');
console.log(a);
